import store from '../store'

class PageSizeUtils {

    constructor() {
    }

    static pageSize(id) {
        let height = window.document.body.clientHeight;
        if (height < 480) {
            store.dispatch("savePaginationSize", 10)
        }
        if (height >= 480 && height < 900) {
            store.dispatch("savePaginationSize", 20)
        }
        if (height >= 900) {
            store.dispatch("savePaginationSize", 30)
        }
    }

    static setPagination(pagination) {
        if (pagination != null) {
            store.dispatch("savePagination", {
                total: pagination.total,
                current: pagination.current,
                size: pagination.size
            })
        }
    }

}

export default PageSizeUtils;